package com.lyn.solitude.host_ui.viewModel

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.alibaba.fastjson.JSONObject
import com.lyn.solitude.entity.RemotePlugin
import com.lyn.solitude.host_ui.helper.OkHttpHelper
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import okhttp3.Request
import okhttp3.RequestBody.Companion.toRequestBody

/**
 *
 * @author longyn 2024/05/29
 * @version 1.0.0
 */
class PluginStoreViewModel : ViewModel() {

    val remotePluginLiveData:MutableLiveData<RemotePlugin> = MutableLiveData()

    fun getAllRemotePlugin(){
        viewModelScope.launch(Dispatchers.IO){
            val dataJSON = JSONObject()
            val requestBody = dataJSON.toJSONString().toRequestBody(OkHttpHelper.jsonMediaType)
            val request = Request.Builder()
                .url("")
                .post(requestBody)
                .build()
            val response = OkHttpHelper.okHttpClient.newCall(request).execute()

        }
    }
}